<ui-component name="miniform" path="common.form2" config="if:~PATH~;icon:ti ti-globe;autofocus:true;reload:?/reload;submit:?/submit;width:450;zindex:20" class="hidden" plugin="~PATH~">
	<div class="padding">

		<ui-component name="input" path="?.url" config="required:1" default="'https://'">@(TMS endpoint)</ui-component>
		<div class="help m">@(Enter absolute URL address to TMS endpoint for your app)</div>

		<ui-component name="input" path="?.token" config="required:0;camouflage:*" default="''">@(Token)</ui-component>
		<div class="help">@(Optional, enter the security token)</div>

	</div>
	<nav>
		<ui-component name="validation" path="?">
			<button name="submit" disabled><i class="ti ti-check-circle"></i>@(SUBMIT)</button>
			<button name="cancel">@(Cancel)</button>
		</ui-component>
	</nav>
</ui-component>

<script>

	PLUGIN(function(exports) {

		exports.reload = function(com) {
			var model = exports.model;
			var id = model ? model.id : null;
			com.reconfigure({ title: id ? '@(Update source)' : '@(Add source)' });
		};

		exports.submit = function(hide) {
			var model = exports.form;
			if (!model.id)
				model.id = FUNC.makeid('src');
			FUNC.send({ TYPE: 'source_save', data: model }, ASETTER('message/response', function() {
				EXEC('sourcesform/refresh');
				hide();
			}), true);
		};

	});

</script>